package com.ruoyi.report.service.impl;

import com.ruoyi.common.core.text.Convert;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.report.domain.TCarouselImage;
import com.ruoyi.report.mapper.TCarouselImageMapper;
import com.ruoyi.report.service.ITCarouselImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 轮播图Service业务层处理
 * 
 * @author administrator
 * @date 2025-02-16
 */
@Service
public class TCarouselImageServiceImpl implements ITCarouselImageService
{
    @Autowired
    private TCarouselImageMapper tCarouselImageMapper;

    /**
     * 查询轮播图
     * 
     * @param id 轮播图ID
     * @return 轮播图
     */
    @Override
    public TCarouselImage selectTCarouselImageById(Long id)
    {
        return tCarouselImageMapper.selectTCarouselImageById(id);
    }

    /**
     * 查询轮播图列表
     * 
     * @param tCarouselImage 轮播图
     * @return 轮播图
     */
    @Override
    public List<TCarouselImage> selectTCarouselImageList(TCarouselImage tCarouselImage)
    {
        return tCarouselImageMapper.selectTCarouselImageList(tCarouselImage);
    }

    /**
     * 新增轮播图
     * 
     * @param tCarouselImage 轮播图
     * @return 结果
     */
    @Override
    public int insertTCarouselImage(TCarouselImage tCarouselImage)
    {
        tCarouselImage.setCreateTime(DateUtils.getNowDate());
        return tCarouselImageMapper.insertTCarouselImage(tCarouselImage);
    }

    /**
     * 修改轮播图
     * 
     * @param tCarouselImage 轮播图
     * @return 结果
     */
    @Override
    public int updateTCarouselImage(TCarouselImage tCarouselImage)
    {
        return tCarouselImageMapper.updateTCarouselImage(tCarouselImage);
    }

    /**
     * 删除轮播图对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTCarouselImageByIds(Map<String,String> map)
    {
        String ids = map.get("ids");
        if (ids.isEmpty()) {
            return 0;
        }
        String[] split = ids.split(",");
        List<String> list = Arrays.asList(split);
        return tCarouselImageMapper.deleteTCarouselImageByIds(list);
    }

    /**
     * 删除轮播图信息
     * 
     * @param id 轮播图ID
     * @return 结果
     */
    @Override
    public int deleteTCarouselImageById(Long id)
    {
        return tCarouselImageMapper.deleteTCarouselImageById(id);
    }
}
